//
//  BJVideoListTableViewCell.m
//  BowJoy
//
//  Created by  on 2024/5/23.
//

#import "BJVideoListTableViewCell.h"

@implementation BJVideoListTableViewCell

- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
}
- (void)setModel:(BJAnchorWallModelData *)model{
    if(model.avatar){
        [self.headerIcon sd_setImageWithURL:[NSURL URLWithString:model.avatar] completed:nil];
    }else{
        self.headerIcon.image = [UIImage imageNamed:@"ic_head_1"];
    }
    self.titleL.text = [self getLenghtStr:model.nickname withCount:12];
    self.contenL.text = [self getLenghtStr:model.content withCount:15];
    [self.anchorImage sd_setImageWithURL:[NSURL URLWithString:model.anchorUrl] completed:nil];

    self.followIcon.image = model.isLike ? [UIImage imageNamed:@"icon_love_red"]:[UIImage imageNamed:@"icon_love_gray"];
    self.folloeNumL.text = [NSString stringWithFormat:@"%ld",model.followNum];
//    int randomNumber = 10 + arc4random_uniform(51);
//    self.pushTime.text = [NSString stringWithFormat:@"%dmin ago",randomNumber];
    
}

- (NSString *)getLenghtStr:(NSString *)str withCount:(NSInteger)count{
    NSString * str1 = str;
    if (str.length>count){
        NSRange range = [str rangeOfComposedCharacterSequenceAtIndex:count];
        NSString *subStr = [str substringToIndex:range.location];
        str1 = [NSString stringWithFormat:@"%@...",subStr];
    }
    
    return str1;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
